<template>
  <el-card>
      <el-button type="primary" @click="getHtml">getHtml</el-button>
      <el-button type="success" @click="setHtml">setHtml</el-button>

      <el-divider></el-divider>
      <VueWangEditor ref="editor" id="editor" width="100%"></VueWangEditor>
  </el-card>
</template>

<script>
// 1-导入
import VueWangEditor from 'vue-wangeditor';
export default {
    // 2-注册组件
    components:{
        VueWangEditor
    },
    data(){
        return {
            html:`
                <h1>hello wangeditor</h1>
            `
        }
    },
    methods:{
        getHtml(){
            console.log(this.$refs.editor.getHtml());
        },
        setHtml(){
            this.$refs.editor.setHtml(this.html);
        }
    }
}
</script>

<style>

</style>